#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
using namespace std;
class Linkstr
{
    struct node
    {
        string si;
        int si_len;
        node *next;
    };
    public :
        node *head;
        Linkstr();
        void create(string s);
        void insert(string s,int location);
        void print();
};
Linkstr::Linkstr()
{
    head =new node;
    head->next = NULL;
    head->si_len = 0;
    head->si = "";
}
void Linkstr::create(string s)
{
    node *p=head;
    while(p->next!=NULL)
    {
        p=p->next;
    }
    node *new_node=new node;
    new_node->si=s;
    new_node->si_len=s.length();
    new_node->next=NULL;
    p->next=new_node;   
}
void Linkstr::insert(string s,int location)
{
    node *p=head,*q=head;
    int sum_len=0;
    while(p->next!=NULL&&sum_len<location)
    {
        sum_len+=p->si_len;
        q=p;
        p=p->next;
    }
    if(p->next==NULL&&sum_len<location)
    {
        node *new_node=new node;
        new_node->si=s;
        new_node->si_len=s.length();
        new_node->next=p->next;
        p->next=new_node;
    }
    else if(sum_len==location)
    {
        node *new_node=new node;
        new_node->si=s;
        new_node->si_len=s.length();
        new_node->next=p;
        q->next=new_node;
    }
    else if(sum_len>location )
    {
        string temp=q->si;
        string t1=temp.substr(0,location-sum_len);
        string t2=temp.substr(location-sum_len,q->si_len-1);
        string new_si=t1+s+t2;
        q->si=new_si;
        q->si_len=new_si.length();
    }
}    
void Linkstr::print()
{
    node *p=head->next;
    while(p!=NULL)
    {
        cout<<p->si<<' ';
        p=p->next;
    }    
}
int main()
{
    char main_str[10000];
    gets(main_str); 
    Linkstr ls;
    int n1=strlen(main_str);
    int j=0;string temp_str;
    for(int i=0;i<n1;i++)
    {
        if(j==3)
        {
            ls.create(temp_str);
            j=0;
            temp_str="";
            temp_str+=main_str[i];
        }
        else 
        {
            temp_str+=main_str[i];
            j++;
        }
    }
    if(j!=0)
    {
        ls.insert(temp_str,n1-j);
    }
    ls.print();
    cout<<"请输入插入字串"<<endl;
    string s;
    cin>>s;
    int location;
    cout<<"请输入插入位置"<<endl;
    cin>>location;
    ls.insert(s,location);
    ls.print();
    return 0;
}